﻿namespace WebPacker.Packs
{
	using System;

	internal sealed class PackKey : IEquatable<PackKey>
	{
		private readonly string packName;
		private readonly PackType packType;

		public PackKey(PackType packType, string packName)
		{
			if (packName == null)
			{
				throw new ArgumentNullException("packName");
			}

			this.packName = packName;
			this.packType = packType;
		}

		public override bool Equals(object other)
		{
			return Equals(other as PackKey);
		}

		public override int GetHashCode()
		{
			return (packName.GetHashCode() * 47) + packType.GetHashCode();
		}

		public bool Equals(PackKey other)
		{
			return other != null && packType == other.packType && packName == other.packName;
		}
	}
}
